package day16.pack8;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.SneakyThrows;

import java.io.*;
import java.util.Scanner;
// 序列化：把内存的数据持久化到磁盘
public class Test {
    public static void main(String[] args) throws IOException {
        Scanner input = new Scanner(System.in);
        Clazz clazz = new Clazz(30, "班班", 10);
        clazz.CLAZZ_TYPE = "多媒体";
        File file = new File("d:\\games.data");
        file.createNewFile();
        OutputStream os = new FileOutputStream(file);
        try(ObjectOutputStream bos = new ObjectOutputStream(os)) {
            // 序列化...
            bos.writeObject(clazz);
        }
    }
}
